#include "PlaneNavigation.h"

CamPos camPos;
CP_MUTEXLOCK mlock;
void __stdcall *threadfunc()
{
	updatePosition(&camPos, &mlock);
}

pthread_t tid;
int main()
{
	pthread_mutex_init(&mlock, NULL);
	camPos.err_no = 0;
	pthread_create(&tid, NULL, threadfunc, NULL);
	while (1)
	{
#if WIN32
		WaitMutexCP(*mlock);
#else 
		pthread_mutex_lock(&mlock);
#endif
		if(camPos.err_no == -1)return 0;
		if (camPos.isInitDet)
		{
			printf("find mark point (%d,%d)\n", camPos.initPt.x, camPos.initPt.y);
		}
		else
		{
			printf("cam't find mark\n");
		}
#if WIN32
		ExitMutexCP(*mlock);
#else 
		pthread_mutex_unlock(&mlock);
#endif
		DelayCP(20);
	}
}